package com.x52im.rainbowchat.http.logic.pay.alipay;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.eva.epc.common.util.CommonUtils;
import com.eva.framework.dbpool.DBShell;

import java.util.Map;

/**
 * 验证支付密码
 */
public class MPayPsw {
    DBShell db = new DBShell();

    public String check(String newDataJSON) throws Exception {
        String msg = "0";
        JSONObject jsonObject = JSON.parseObject(newDataJSON);
        String userUid = jsonObject.getString("userUid");
        String payPsw = jsonObject.getString("payPsw");
        String sql = "SELECT pay_psw FROM missu_users WHERE user_uid=" + userUid;
        String payPswFrom = db.querySingleItem(sql);
        if (!CommonUtils.isStringEmpty(payPswFrom)) {
            if (payPswFrom.equals(CommonUtils.encyptPassword(payPsw, ""))) {
                msg = "1";
            }
        }
        return msg;
    }
}
